<?php
namespace app\servergoods\validate;
use \app\manage\validate\BaseValidate;

class GoodsCategory extends BaseValidate
{
    //验证规则
	protected $rule =   [
        'name'  => ['length'=>'2,25'],
        'id'    => ['integer','gt'=>0],
        'pid'   => ['integer','egt'=>0],
        'order' => ['integer','egt'=>0],
        'status'=> ['in'=>'0,1'],
        'recommend' => ['regex' => '^(\w)+(,\w+)*'],  //  brand,person
    ];

    protected $message  =   [];

    protected $scene = [
        'goodsCateList' => [
            'id'  => ['require','integer','egt'=>0],
        ],
        'oneCateInfo' => ['id' => ['require','integer','gt'=>0],'app_id'],
        'addGoodsCate' => ['app_id','name','pid','order'],
        'editGoodsCate' => ['id','app_id','name','pid','order'],
        'changeCateStatus' => [
            'status' => ['in'=>'0,1'],
            'id'     => ['require','array','min'=>1]
        ],
        'delCate' => [
            'id'  => ['require','array','min'=>1],
        ],
        'parentAllAttrs' => [
            'pid'   => ['integer','gt'=>0],
        ]
    ];

}